# -*- coding: utf-8 -*- 
# Diseño gráfico de gestión de relaciones entre clases.

## vipera, un diseñador de aplicaciones para Python
##     Copyright (C) 2011 Ángel Luis García García
##
##    This program is free software: you can redistribute it and/or modify
##    it under the terms of the GNU General Public License as published by
##    the Free Software Foundation, either version 3 of the License, or
##    (at your option) any later version.
##
##    This program is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##    GNU General Public License for more details.
##
##    You should have received a copy of the GNU General Public License
##    along with this program.  If not, see <http://www.gnu.org/licenses/>.

import wx

from i18n_vipera import t

class panel_crear_relacion (wx.Panel):
    '''Panel de creación de relaciones entre clases'''
    def __init__(self, parent, idioma = None):
        '''Constructor de clase'''        
        wx.Panel.__init__ (self, parent, -1, 
                           size = wx.Size(500,234), 
                           style = wx.TAB_TRAVERSAL)
        # Idioma.
        self.l = idioma
        bSizer1 = wx.BoxSizer( wx.VERTICAL )
        self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, t(u"CREAR RELACIÓN", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText1.Wrap( -1 )
        bSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.ALL, 15 )
        bSizer2 = wx.BoxSizer( wx.VERTICAL )
        fgSizer1 = wx.FlexGridSizer( 2, 2, 5, 5 )
        fgSizer1.AddGrowableCol( 0 )
        fgSizer1.AddGrowableCol( 1 )
        fgSizer1.AddGrowableRow( 0 )
        fgSizer1.AddGrowableRow( 1 )
        fgSizer1.SetFlexibleDirection( wx.BOTH )
        fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
        self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, t(u"CLASE PADRE", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText2.Wrap( -1 )
        fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
        self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, t(u"CLASE HIJO", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText3.Wrap( -1 )
        fgSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 )
        m_comboBox_padreChoices = []
        self.m_comboBox_padre = wx.ComboBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_comboBox_padreChoices, wx.CB_READONLY )
        fgSizer1.Add( self.m_comboBox_padre, 0, wx.ALL|wx.EXPAND, 5 )
        m_comboBox_hijoChoices = []
        self.m_comboBox_hijo = wx.ComboBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_comboBox_hijoChoices, wx.CB_READONLY )
        fgSizer1.Add( self.m_comboBox_hijo, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer2.Add( fgSizer1, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
        self.m_button_aceptar = wx.Button( self, wx.ID_ANY, t(u"ACEPTAR", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer4.Add( self.m_button_aceptar, 0, wx.ALL|wx.EXPAND, 5 )
        self.m_button_cancelar = wx.Button( self, wx.ID_ANY, t(u"CANCELAR", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer4.Add( self.m_button_cancelar, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer2.Add( bSizer4, 0, wx.EXPAND|wx.ALL, 15 )
        bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
        self.SetSizer( bSizer1 )
        self.Layout()

        # Bindings
        self.m_button_aceptar.Bind( wx.EVT_BUTTON, self.OnAceptar )
        self.m_button_cancelar.Bind( wx.EVT_BUTTON, self.OnCancelar )

    # Manejadores de eventos.
    def OnAceptar( self, event ):
        '''Event handler de aceptación'''
        event.Skip()

    def OnCancelar( self, event ):
        '''Event handler de cancelación'''
        event.Skip()

class panel_eliminar_relacion ( wx.Panel ):
    '''Panel de eliminación de relaciones entre clases'''
    def __init__(self, parent, idioma = None ):
        '''Constructor de clase'''        
        wx.Panel.__init__ ( self, parent, id = -1,
                            size = wx.Size( 500,234 ),
                            style = wx.TAB_TRAVERSAL )
        # Idioma.
        self.l = idioma
        bSizer1 = wx.BoxSizer( wx.VERTICAL )
        self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, t(u"ELIMINAR RELACIÓN", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText1.Wrap( -1 )
        bSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.ALL, 15 )
        bSizer2 = wx.BoxSizer( wx.VERTICAL )
        fgSizer1 = wx.FlexGridSizer( 1, 1, 5, 5 )
        fgSizer1.AddGrowableCol( 0 )
        fgSizer1.AddGrowableRow( 0 )
        fgSizer1.SetFlexibleDirection( wx.BOTH )
        fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
        m_comboBox_relacionChoices = []
        self.m_comboBox_relacion = wx.ComboBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_comboBox_relacionChoices, wx.CB_READONLY )
        fgSizer1.Add( self.m_comboBox_relacion, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer2.Add( fgSizer1, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
        self.m_button_aceptar = wx.Button( self, wx.ID_ANY, t(u"ACEPTAR", self.l) , wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer4.Add( self.m_button_aceptar, 0, wx.ALL|wx.EXPAND, 5 )
        self.m_button_cancelar = wx.Button( self, wx.ID_ANY, t(u"CANCELAR", self.l), wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer4.Add( self.m_button_cancelar, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer2.Add( bSizer4, 0, wx.EXPAND|wx.ALL, 15 )
        bSizer1.Add( bSizer2, 1, wx.ALL|wx.EXPAND, 5 )
        self.SetSizer( bSizer1 )
        self.Layout()

        # Binding.
        self.m_button_aceptar.Bind( wx.EVT_BUTTON, self.OnAceptar )
        self.m_button_cancelar.Bind( wx.EVT_BUTTON, self.OnCancelar )

    # Manejadores de eventos.
    def OnAceptar( self, event ):
        '''Event handler de aceptación'''
        event.Skip()

    def OnCancelar( self, event ):
        '''Event handler de cancelación'''
        event.Skip()
